package com.example.demo.controller;

import com.example.demo.factory.ThreadExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("/apollo")
public class ApolloDemoController {
    @Resource
    private ThreadExecutor threadExecutor;

    @GetMapping("/read_demo")
    public Properties apolloReadDemo() throws InterruptedException {
        while (true) {
            threadExecutor.execute("bizName", new Runnable() {
                @Override
                public void run() {
                    System.out.println("bizInfo");
                }
            });
            TimeUnit.SECONDS.sleep(1);
        }
    }
}
